// [ top, left, width, height ] in percentages
var window1 = [ 0.01, 0.01, 0.48, 0.48 ];
var window2 = [];
var window3 = [];
var window4 = [];

var windows = [
				[ 0.01, 0.5, 0.48, 0.48 ],
				[ 0.01, 0.01, 0.48, 0.48 ],
				[ 0.5, 0.01, 0.48, 0.48 ],
				[ 0.5, 0.5, 0.48, 0.48 ]
              ];

function irc_init () {
	irc_resize();
	window.onresize = irc_resize;
}

function irc_resize () {
	//browser width and height
    if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
			winW = window.innerWidth;
			winH = window.innerHeight;
		} else if (navigator.appName.indexOf("Microsoft")!=-1) {
			winW = document.body.offsetWidth;
			winH = document.body.offsetHeight;
		} else {
			winH = document.body.clientHeight;
			winW = document.body.clientWidth;
		}
    }
    
    for ( n = 0; n < windows.length; n++ ) {
    	var box = $( 'irc' + (n+1)  );
    	var boxshade = $( 'boxshade' + (n+1) );
    	var windowshade = $( 'windowshade' + (n+1) );
    	var win = $( 'window' + (n+1) );
    	win_width = winW * windows[n][2];
    	win_height = winH * windows[n][3];
		box.style.top = winH * windows[n][0] + "px";
		box.style.left = winW * windows[n][1] + "px";
		box.style.width = win_width + "px";
		box.style.height = win_height + "px";
		boxshade.style.width = win_width - 2 + "px";
		boxshade.style.height = win_height - 2 + "px";
		windowshade.style.width = win_width - 8 + "px";
		windowshade.style.height = win_height - 32 + "px";
		win.style.width = win_width - 10 + "px";
		win.style.height = win_height - 34 + "px";
    }
    
    //window1
//     var win1 = $('irc1');
//     var win1boxshade = $('boxshade1');
//     var win1windowshade = $('windowshade1');
//     var win1window = $('window1');
//     win_width = winW * window1[2];
//     win_height = winH * window1[3];
//     win1.style.top = winW * window1[0] + "px";
//     win1.style.left = winH * window1[1] + "px";
//     win1.style.width = win_width + "px";
//     win1.style.height = win_height + "px";
//     win1boxshade.style.width = win_width - 2 + "px";
//     win1boxshade.style.height = win_height - 2 + "px";
//     win1windowshade.style.width = win_width - 8 + "px";
//     win1windowshade.style.height = win_height - 32 + "px";
//     win1window.style.width = win_width - 10 + "px";
//     win1window.style.height = win_height - 34 + "px";
//     
    
}

// this function is need to obtain style properties (primarily for compatibility with safari)
function get_style(oElm, strCssRule){
	oElm = document.getElementById( oElm );
    var strValue = "";
    if(document.defaultView && document.defaultView.getComputedStyle){
        strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
    }
    else if(oElm.currentStyle){
        strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
            return p1.toUpperCase();
        });
        strValue = oElm.currentStyle[strCssRule];
    }
    strValue = parseInt( strValue );
    return strValue;
}